﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<fivescomplement.Models.GetInstructorsResults_Result  >>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Instructor Report
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Instructor Report</h2>
   
        <% using (Html.BeginForm()) { %>
            <div>
                <fieldset>
                 <% if (Model.Count() > 0)
                    { %>
                    <% int test;%>
                    <% int questiontype;%>
                    <% test = 0;%>
                    <% questiontype = 0;%>
                    <% foreach (var item in Model)
                       { %>
                            <% if (test != item.CourseID)
                            { %>
                                    <table>
                                        <tr>
                                            <td>
                                                Course: <%:item.CourseName%>
                                            </td>

                                        </tr>

                                        <tr>
                                            <td>
                                                <b>Instructor:  <%:item.InstructorsLastname + ", " + item.InstructorsFirstName %></b>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td>
                                                <u>Question</u>
                                            </td>

                                            <td>
                                                <u>Average Rating</u>
                                            </td>
                                            <td>
                                                <u>Responses</u>
                                            </td>
                                        </tr>
                                   
                                    <tr>
                                    <% test = item.CourseID;%>
                             <% } %>

                                <% if (item.QuestionTypeID == 1)
                                { %>
                                 <td>
                                    <%:item.Question%>
                                </td>

                                <td>
                                    <%:item.TotalRating%>
                                </td>   
                                <td>
                                    <%:item.Number%>
                                </td>

                                <% } %>
                                <% else if (item.QuestionTypeID == 3)
                                { %>
                                    <% if (questiontype != 3)
                                    { %>
                                       
                                        <td>
                                            <br /><br />
                                            <u>Question</u>
                                        </td> 
                                           
                                        <td>
                                            <br /><br />
                                            <u>Comments</u>
                                        </td>
                                     <% } %>
                                </tr>

                                <tr>
                                    <td>
                                        <%:item.Question%>
                                    </td>

                                    <td>
                                        <%:item.ResponseComment %>
                                    </td>

                                <% questiontype = item.QuestionTypeID;%>

                                <% } %>
                            
                                </tr>
    
                    <% } %>

                    </table>
                
                <% } %>
                <%else{ %>
                    <h1>No Records Found</h1>
                 <% } %>
                </fieldset>
            </div>
        <% } %>
</asp:Content>
